<?php

if (!defined('_PAGE_'))
    include _FLEP_LIB_DIR_.'/page.inc';

$css = array('main.css', 'table.css', 'title_menu.css', 'title_msg.css', 'lightbox.css');
$javascript = array('common.js', 'estudiante.js', 'ajax.js', 'request.js', 'search.js', 'delete.js', 'lightbox.js');

$structure = flep_page_init('pago');

function include_page($structure){
$user = &$_SESSION['user'];
?>
    <b>Pagos</b>
    <br><br>
    <div class="menu">
        <?php flep_page_search('pago'); ?>
    </div>
    <br>
    <table>
    <tr>
    <td>
      <b><?php
        flep_page_message();
        flep_page_navigation($structure);
    ?></b>
    </td><td>&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2">
        <br>
    <table class="list">
        <thead><tr><th>N&deg;</th>
        <th>Nombre</th>
        <th>Carnet</th>
        <?php
            foreach($structure['fields'] as $id => &$field){
              if($id !== 'inscripcion_id')
                printf('<th>%s</th>', $field['title']);
            }
            unset($field);
        ?>
        <th>Nivel</th>
        <th></th>
<!--         <th></th> -->
        </tr></thead>
        <tfoot>
            <tr><th colspan="9"></th></tr>
        </tfoot>
        <tbody><?php
            if(flep_search_all($structure)){
                for($i = 0; $i < count($structure['data']); $i++){
                    printf('<tr><td>%s</td>', $structure['offset'] + $i+1);
                    printf('<td>%s</td>', $structure['data'][$i]['nombre']);
                    printf('<td>%s</td>', strtoupper($structure['data'][$i]['usuario']));
                    printf('<td>%01.2f</td>', $structure['data'][$i]['cantidad']);
                    printf('<td>%s</td>', $structure['data'][$i]['fecha_pago']);
                    printf('<td>%s</td>', $structure['data'][$i]['recibo']);
                    printf('<td style="text-align:center;padding:0px;"><img src="img/%s.png" title="Exonerado"></td>', ($structure['data'][$i]['exonerado']?'ok':'close'));
                    printf('<td>%s</td>', $structure['data'][$i]['nivel']);
//                     printf('<td style="text-align:center;padding:0px;"><img onclick="flep_add_pago(\'%s\');" src="img/edit.png" title="Pago"></td>', flep_encode($structure['data'][$i]['id']));
                    printf('<td style="text-align:center;padding:0px;"><img src="img/delete.png" onclick="flep_delete(\'pago\', \'%s\', this.parentNode)" title="Eliminar"></td>', flep_encode($structure['data'][$i]['id']));
                }
            }else{
                printf('<tr><td colspan="%s">No se encontraron cursos - Haga click en Agregar.</td></tr>', count($structure['fields'])+4);
            }
        ?></tbody>
    </table>
        </td></tr>
  </table>
<?php
}

?>
